package com.bestcem.xm.ticket.dao;

import com.bestcem.xm.ticket.entity.mongo.TicketRecord;

import java.time.LocalDateTime;
import java.util.List;

/**
 * mongo DS_TICKET_RECORD 相关DAO层方法
 *
 * @author XiaoYunSong <ys.xiao@idiaoyan.com>
 * @version v1.0
 * @date 2021/8/11 14:11
 */
public interface TicketRecordDao {

    /**
     * 根据id查询 TicketRecord
     *
     * @param id TicketRecordId
     * @return TicketRecord 信息
     * @author XiaoYunSong <ys.xiao@idiaoyan.com>
     * @date 2021/8/11 15:36
     */
    TicketRecord findById(String id);


    /**
     * 根据ticketId查询所有ticketRecord
     *
     * @param ticketId
     * @return java.util.List<com.bestcem.xm.ticket.entity.mongo.TicketRecord>
     * @author zhangfeng <feng.zhang@idiaoyan.com>
     * @date 2021/9/28 14:48
     */
    List<TicketRecord> listByTicketId(String ticketId);

    /**
     * 根据 TicketId 查询 TicketRecord
     *
     * @param ticketId TicketId
     * @return TicketRecord 信息
     * @author liheng
     * @date 2021/8/11 15:36
     */
    TicketRecord findLastOneByTicketId(String ticketId);

    /**
     * 获取工单的提交跟进记录
     *
     * @param ticketId TicketId
     * @return TicketRecord 信息
     * @author XiaoYunSong <ys.xiao@idiaoyan.com>
     * @date 2021/9/22 15:25
     */
    TicketRecord findFollowByTicketId(String ticketId);

    /**
     * 根据具体的记录时间获取工单的提交跟进记录
     * 根据调用的时间来判断是否是新增，需要传递调用的时间
     *
     * @param ticketId
     * @param createTime
     * @return TicketRecord
     * @author jy.zhao
     * @date 2021/8/24 19:27
     **/
    TicketRecord findTicketFollowRecordByEvent(String ticketId, Integer event, LocalDateTime createTime);

    /**
     * 保存 TicketRecord 信息
     *
     * @param entity 要保存的ticketRecord
     * @return 保存后的 TicketRecord 信息
     * @author XiaoYunSong <ys.xiao@idiaoyan.com>
     * @date 2021/8/11 15:58
     */
    TicketRecord saveTicketRecord(TicketRecord entity);
}
